//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.warrior.superdata.base;

import com.warrior.superdata.enums.ResultEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;

@ApiModel("通用返回结构")
public class CommonResult<T> implements Serializable {
    private static final long serialVersionUID = 6116515098874945764L;
    @ApiModelProperty("操作代码")
    private int code;
    @ApiModelProperty("操作信息")
    private String message;
    @ApiModelProperty("返回对象")
    private T data;
    @ApiModelProperty("附加对象")
    private Object ext;

    public CommonResult() {
        this.code = ResultEnum.SUCCEED.getCode();
        this.message = ResultEnum.SUCCEED.getMessage();
    }

    public CommonResult(Exception e) {
        this.code = ResultEnum.ERROR.getCode();
        this.message = e.getMessage();
    }

    public CommonResult(T data) {
        this.code = ResultEnum.SUCCEED.getCode();
        this.message = ResultEnum.SUCCEED.getMessage();
        this.data = data;
    }

    public CommonResult(int code, String message, T data, Object ext) {
        this.code = code;
        this.message = message;
        this.data = data;
        this.ext = ext;
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public T getData() {
        return this.data;
    }

    public Object getExt() {
        return this.ext;
    }

    public void setCode(final int code) {
        this.code = code;
    }

    public void setMessage(final String message) {
        this.message = message;
    }

    public void setData(final T data) {
        this.data = data;
    }

    public void setExt(final Object ext) {
        this.ext = ext;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof CommonResult)) {
            return false;
        } else {
            CommonResult<?> other = (CommonResult)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getCode() != other.getCode()) {
                return false;
            } else {
                label49: {
                    Object this$message = this.getMessage();
                    Object other$message = other.getMessage();
                    if (this$message == null) {
                        if (other$message == null) {
                            break label49;
                        }
                    } else if (this$message.equals(other$message)) {
                        break label49;
                    }

                    return false;
                }

                Object this$data = this.getData();
                Object other$data = other.getData();
                if (this$data == null) {
                    if (other$data != null) {
                        return false;
                    }
                } else if (!this$data.equals(other$data)) {
                    return false;
                }

                Object this$ext = this.getExt();
                Object other$ext = other.getExt();
                if (this$ext == null) {
                    if (other$ext != null) {
                        return false;
                    }
                } else if (!this$ext.equals(other$ext)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof CommonResult;
    }

    public int hashCode() {
        int result = 1;
        result = result * 59 + this.getCode();
        Object $message = this.getMessage();
        result = result * 59 + ($message == null ? 43 : $message.hashCode());
        Object $data = this.getData();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        Object $ext = this.getExt();
        result = result * 59 + ($ext == null ? 43 : $ext.hashCode());
        return result;
    }

    public String toString() {
        return "CommonResult(code=" + this.getCode() + ", message=" + this.getMessage() + ", data=" + this.getData() + ", ext=" + this.getExt() + ")";
    }
}
